package com.baizw.cultivation.common.properties;

import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 云舒配置类
 *
 * @author 剧终1204
 * @version V1.0
 * @date 2020年06月16日 11:53
 */
@Data
@Component
@EnableConfigurationProperties
@ConfigurationProperties(prefix = "spring.cultivation")
public class CultivationProperties {

    /**
     * 国密算法加密参数
     */
    private String sm4Key;

    /**
     * redis及token 过期时间
     * 单位: 秒
     */
    private int expireTime;

    private UploadProperties upload = new UploadProperties();

    private GeneratorProperties generator = new GeneratorProperties();

    public byte[] sm4KeyBytes() {
        return StrUtil.bytes(this.sm4Key, CharsetUtil.UTF_8);
    }
}
